<?php
class StudentTag extends Zend_Db_Table{
    protected $_name ="student_tag";
	protected $_primary = 'id';

     //根据file_id 查询studenttag
    public function getstudenttagByid($file_id){
          $select = $this->select();
          $select->where("id=".$file_id);
          return $this->fetchAll($select)->toArray();
    }

         //根据file_id 查询studenttag
    public function getstudenttagBystudent_id($file_id){
          $select = $this->select();
          $select->where("student_id=".$file_id);
          return $this->fetchAll($select)->toArray();
    }

             //根据tag_id 查询studenttag
    public function getstudenttagBytag_id($tag_id,$page,$perpage){
          $select = $this->select();
          $select->where("tag_id=".$tag_id);
       if($page!=9999){
			$select->limitPage($page,$perpage);
		}
          return $this->fetchAll($select)->toArray();
    }

    public function delstudenttagBystudentid($student_id,$tag_id){
         $where = "student_id=".$student_id." and tag_id=".$tag_id;
         $this->delete($where);
         return true;
    }

 //更新studenttag
    public function updatestudenttagByid($array,$file_id){

		$db = $this->getAdapter();
		$where=$db->quoteInto('id = ?', $file_id);
		$this->update($array, $where);
	}
//删除studenttag
     public function delstudenttagByid($file_id){
          $where = 'id = '. $file_id;
         $this->delete($where);
         return true;
    }
	
	public function getStudentTag(){
		$select = $this->select();
		return $this->fetchAll($select)->toArray();
	}
}
?>
